﻿using Sasc.PV.BLL.ZhuDing;
using Sasc.PV.DAL;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Sasc.PV.Web.Admin.Zhuding
{
    public partial class ShaoJieYunZhuanAdd : PVGongXuAdminPage<ZhuDingCheJianManagement, ZhuDingShaoJieGongXu, ZhuDingGongXuTarget>
    {
        #region Page Load
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!HasPermission(GongXuQuanXianLeiXing.ADD))
                MessageBox.ShowAndRedirect(this, "对不起，没有权限访问该页面。", "PenTu");
        }
        #endregion

        #region GetQuanXianValue
        protected override string GetQuanXianValue()
        {
            return "103";
        }
        #endregion

        #region Submit Button
        protected void SubmitImageButton_Click(object sender, ImageClickEventArgs e)
        {
            var reason = string.Empty;

            var model = new PvZDShaoJieCollection
            {
                CreatedBy = LoginUserName,
                CreatedDate = DateTime.Now,
                LastUpdatedBy = LoginUserName,
                LastUpdatedDate = DateTime.Now,
                BeiZhu = string.Empty,
                GanGuoZhuiZongDanMatch = GanGuoZhuiZongDanMatchTextBoxCheckBox.Checked,
                GongYiMingCheng = string.Empty,
                JianCheDanZhuiZongDanOK = JianCheDanZhuiZongDanOKCheckBox.Checked,
                JiaReBangOK = JiaReBangOKCheckBox.Checked,
                ShaoJieLuBianHao = ShaoJieLuBianHaoTextBox.Text,
                YunXingQianJiaChaRen = ShaoJieLuYunXingJianChaRenTextBox.Text
            };

            if (model.Add()>0)
            {
                MessageBox.ShowAndRedirect(this, "《烧结炉运转记录单》创建成功！", "ShaoJieYunZhuan");
            }
            else
            {
                MessageBox.Show(this, reason);
            }
        }
        #endregion
    }
}